package com.zyy.ui.validations;

import com.zyy.ui.annotations.ListNotEmpty;
import com.zyy.ui.utils.CollectionUtil;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.List;

/**
 * @ClassName: ListNotEmptyValidator
 * @Description: 校验类
 * @Author: zyy
 * @Date: 2020/05/03 17:21
 * @Version: 1.0
 */
public class ListNotEmptyValidator implements ConstraintValidator<ListNotEmpty, List> {
    @Override
    public boolean isValid(List list, ConstraintValidatorContext constraintValidatorContext) {
        if (CollectionUtil.isEmpty(list)) {
            return false;
        }
        return true;
    }
}
